package com.lyt.springboot.util.algorithm;
import java.util.Scanner;

public class S42 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String input = in.nextLine();
        StringBuilder result = new StringBuilder();
        //定义
        Boolean isBig = false;
        Boolean isLow = false;
        Boolean isNum = false;
        Boolean isSpace = false;

        for (char s : input.toCharArray()) {
            if (s == '<') {
                if (result.length() > 0) {
                    result.deleteCharAt(result.length() - 1);
                }
            } else {
                result.append(s);
            }
        }
        for (char a : result.toString().toCharArray()) {
            if (Character.isLowerCase(a)) {
                isLow = true;
            } else if (Character.isUpperCase(a)) {
                isBig = true;
            } else if (Character.isDigit(a)) {
                isNum = true;
            } else {
                isSpace = true;
            }
        }
        if (result.length() >= 8 && isBig && isLow && isNum && isSpace) {
            System.out.println("ok, " + result);
        } else {
            System.out.println("nok");
        }
    }

}
